//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "DPCnsFlx.h"
#include "DPGrfFlx.h"
#include "RLCnsFlx.h"
#include "DModule.h"
#include "stdm.h"

//---------------------------------------------------------------------------
#pragma package( smart_init )
#pragma link "DialPad"
#pragma link "PHDS"
#pragma link "PHEdit"
#pragma link "PHLabel"
#pragma link "PHGridEd"
#pragma link "DIALPAD"
#pragma resource "*.dfm"
TDPCnsFlx1*  DPCnsFlx1;

//---------------------------------------------------------------------------
__fastcall TDPCnsFlx1::TDPCnsFlx1( TComponent*  Owner ) : TDiPad( Owner )
{
  PHDS1->Tabela = DM->TBGeral;
  DSFlx->Tabela = DM->TBFlxFin;
}

//---------------------------------------------------------------------------
void __fastcall TDPCnsFlx1::BitBtn4Click( TObject*  Sender )
{
  try
   {
    DPGrfFlx1 = new TDPGrfFlx1( NULL );
    DPGrfFlx1->ShowModal();
   }

  __finally
   {
    delete DPGrfFlx1;
   }

}

//---------------------------------------------------------------------------
void __fastcall TDPCnsFlx1::BitBtn3Click( TObject*  Sender )
{
  TPedeRel1*  PR;
  TRLCnsFlx1*  RLCnsFlx1 = new TRLCnsFlx1( NULL );
  try
   {
    PR = new TPedeRel1( NULL );
    PR->Report = RLCnsFlx1->PHReport1;
    PR->ShowModal();
   }

  __finally
   {
    Close();
    delete RLCnsFlx1;
    delete PR;
   }

}

//---------------------------------------------------------------------------
void __fastcall TDPCnsFlx1::DSFlxAfterOpen( TObject*  Sender )
{
  Flx = ( struct FLXFIN* ) DSFlx->Buffer;
}

//---------------------------------------------------------------------------
void __fastcall TDPCnsFlx1::BitBtn1Click( TObject*  Sender )
{
  if( DPA->DPCnsFlxDataInicial > DPA->DPCnsFlxDataFinal )
   {
    throw Exception( "'Data Inicial' deve ser menor que 'Data Final'." );
   }
}

//---------------------------------------------------------------------------

